package text_2023_09_22;

import java.util.Scanner;

/**
 * @author Vv
 * @version 1.0
 * @project coding_learn
 * @description
 * @date 2023/9/22 08:41:23
 */
public class emailIsIllegal extends Exception {
    public String email;

    public emailIsIllegal(String str) {
        this.email = str;
    }

    public boolean isIllegal() {
        int charIndex1 = email.indexOf('@');
        int endCharIndex1 = email.lastIndexOf('@');
        int charIndex2 = email.indexOf('.');
        int endCharIndex2 = email.lastIndexOf('.');
        if (charIndex1 == -1) {
            return false;
        }
        if (charIndex1 != endCharIndex1) {
            return false;
        }
        if (charIndex2 < charIndex1) {
            return false;
        }
        if (charIndex2 != endCharIndex2) {
            return false;
        }
        String newEmail = new String(email);
        newEmail = newEmail.replace("@", "");
        newEmail = newEmail.replace(".", "");
        char[] str = newEmail.toCharArray();
        for (int i = 0; i < str.length; i++) {
            char curChar = str[i];
            if(!(curChar >= '0' && curChar <= '9') && !(curChar >= 'a' && curChar <= 'z')){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        emailIsIllegal e = new emailIsIllegal(str);
        System.out.println(e.isIllegal());
    }

}
